package com.yan.proxy.static_;

import com.yan.proxy.IGamePlayer;

public class GamePlayerProxy implements IGamePlayer {
    private IGamePlayer gamePlayer;
    private long startTime;

    public GamePlayerProxy(IGamePlayer gamePlayer) {
        super();
        this.gamePlayer = gamePlayer;
    }

    public void login(String username, byte[] password) {
        this.startTime = System.currentTimeMillis();
        gamePlayer.login(username, password);
    }

    public void killBoss() throws InterruptedException {
        this.gamePlayer.killBoss();
        Thread.sleep((int) (Math.random() * 3000));
    }

    public void upgrade() {
        this.gamePlayer.upgrade();
        System.out.println("升级总用时：" + (System.currentTimeMillis() - startTime) + "ms");
    }
}
